#ifndef ICONHELPER_H
#define ICONHELPER_H

#include <QObject>
#include <QFont>
#include <QAbstractButton>
#include <QLabel>
#include <QPixmap>
#include <QMap>

class IconHelper : public QObject
{
    Q_OBJECT
private:
    static IconHelper* self;
    explicit IconHelper(QObject* parent = nullptr);

public:
    enum EFonts{
        FontAwesome6Light,
        FontAwesome6Regular,
        FontAwesome6Solid,
        FontAwesome6Brands,
        FontAwesome6Duotone
    };

    static IconHelper* instance();

    // 给标签设置图标
    bool setIcon(QLabel* lbl, EFonts fontFamily, int icon, quint8 size = 10);

    // 给按钮设置图标
    bool setIcon(QAbstractButton* btn, EFonts fontFamily, int icon, quint8 size = 10);

    // 根据给定的图标字体，生成一个QPixmap
    QPixmap getPixmap(const QColor& color, EFonts fontFamiliy, int icon, quint8 size = 10, quint8 width = 12, quint8 height = 12);

signals:

private:
    QMap<EFonts, QFont*> m_fonts;
};
#endif  // ICONHELPER_H
